<%@page isELIgnored="false" pageEncoding="UTF-8" contentType="text/html; UTF-8" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>角色管理</title>\
    <style>
        .layui-table-cell{
            display:table-cell;
            vertical-align: middle;
        }
    </style>

    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
<table id="demo" lay-filter="test"></table>
<script>
    layui.use("table",function () {
        var table = layui.table;
        table.render({
            id:"role",
            elem:"#demo",
            cols:[[
                {field:"roleId",title:"编号",sort:true},
                {field:"roleName",title:"角色名"},
                {field:"resources",title:"权限名",templet:function (d) {
                    var str = "";
                        for (var i=0;i<d.resources.length;i++){
                            str+=d.resources[i].resourceName+"<br>";
                        }
                        return str;
                    }
                },

            ]],
            url:"${pageContext.request.contextPath}/admin/showRole",
        });
    })
</script>

</body>
</html>